#include <bits/stdc++.h>
using namespace std;
using ll = long long;

ll rr() {
    ll s = 0, w = false, c = getchar();
    for (; !isdigit(c); c = getchar())
        w = w || c == '-';
    for (; isdigit(c); c = getchar())
        s = s * 10 + c - '0';
    return w ? -s : s;
}

// END OF HEADER

int main() {
    int N = rr();
    queue<int> q1, q2;
    for (int i = 0; i < N; i++) {
        int x = rr();
        if (x % 2 == 1)
            q1.push(x);
        else
            q2.push(x);
    }
    vector<int> ans;
    for (int i = 0; i < N; i++) {
        if (!q1.empty()) {
            ans.push_back(q1.front());
            q1.pop();
        }
        if (!q1.empty()) {
            ans.push_back(q1.front());
            q1.pop();
        }
        if (!q2.empty()) {
            ans.push_back(q2.front());
            q2.pop();
        }
    }
    printf("%d", ans[0]);
    for (int i = 1; i < ans.size(); i++)
        printf(" %d", ans[i]);
    return 0;
}
